import request from '@/utils/request'

export function bind(data) { // 获取部门
  return request({
    url: '/v2/visitor/bind',
    method: 'POST',
    data
  })
}

// 获取访客须知列表
export const getVisitorRuleList = (params) => {
  return request({
    url: '/v2/visitor/rule',
    method: 'GET',
    params
  })
}

// 设置须知
export const setVisitorRule = (data) => {
  return request({
    url: '/v2/visitor/rule',
    method: 'POST',
    data
  })
}

// 修改须知
export const editVisitorRule = (params) => {
  return request({
    url: '/v2/visitor/rule',
    method: 'PUT',
    params
  })
}

// 移除须知
export const removeVisitorRule = (params) => {
  return request({
    url: '/v2/visitor/rule',
    method: 'DELETE',
    params
  })
}

// 启用规则
export const enableVisitorRule = (params) => {
  return request({
    url: '/v2/visitor/rule/enable',
    method: 'PUT',
    params
  })
}

// 根据关键字查找地址
export const searchLocation = (params) => {
  return request({
    url: '/v2/visitorCenter/place/search',
    method: 'GET',
    params
  })
}

// 获取公司信息和到达计划
export const arrivalProgrammes = (params) => {
  return request({
    url: '/v2/visitorCenter/position',
    method: 'GET',
    params
  })
}

// 创建到达计划
export const createArrivalProgrammes = (data) => {
  return request({
    url: '/v2/visitorCenter/position',
    method: 'POST',
    data
  })
}

// 创建到达计划
export const editArrivalProgrammes = (data) => {
  return request({
    url: '/v2/visitorCenter/position/edit',
    method: 'POST',
    data
  })
}

// 根据经纬度获取地址信息
export const resolveCoordinate = (data) => {
  return request({
    url: '/v2/visitorCentre/reverse/geocod',
    method: 'POST',
    data
  })
}

// 获取访客数据统计
export function getVisitorDataStatistics() {
  return request({
    url: `/v2/visitor/statistics`,
    methods: 'GET'
  })
}

// 修改访客
export const editVisitor = (params) => {
  return request({
    url: '/v2/visitor/visit/update',
    method: 'PUT',
    params
  })
}
